<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_151) on Thu May 17 09:03:32 UTC 2018 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>no.steria.osgi.mocks (jsr330activator.mocks 1.1.1-SNAPSHOT API)</title>
<meta name="date" content="2018-05-17">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
    try {
        if (location.href.indexOf('is-external=true') == -1) {
            parent.document.title="no.steria.osgi.mocks (jsr330activator.mocks 1.1.1-SNAPSHOT API)";
        }
    }
    catch(err) {
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../no/steria/osgi/mocks/package-summary.html">Package</a></li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Package</li>
<li>Next&nbsp;Package</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?no/steria/osgi/mocks/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<a name="skip.navbar.top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package&nbsp;no.steria.osgi.mocks</h1>
<div class="docSummary">
<div class="block">This package contains mock implementations of the <a href="http://www.osgi.org/">OSGi framework</a>
 similar to what's found in <a href="https://sling.apache.org/documentation/development/osgi-mock.html">Apache Sling OSGi mocks</a>
 and in <a href="http://docs.spring.io/osgi/docs/current/reference/html/testing.html">Spring OSGi mocks</a>.</div>
</div>
<p>See:&nbsp;<a href="#package.description">Description</a></p>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../no/steria/osgi/mocks/MockBundle.html" title="class in no.steria.osgi.mocks">MockBundle</a></td>
<td class="colLast">
<div class="block">Mock implementation of <code>Bundle</code>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../no/steria/osgi/mocks/MockBundleBase.html" title="class in no.steria.osgi.mocks">MockBundleBase</a></td>
<td class="colLast">
<div class="block">Default implementations for all methods of <code>Bundle</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../no/steria/osgi/mocks/MockBundleContext.html" title="class in no.steria.osgi.mocks">MockBundleContext</a></td>
<td class="colLast">
<div class="block">Mock implementation of <code>BundleContext</code>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../no/steria/osgi/mocks/MockBundleContextBase.html" title="class in no.steria.osgi.mocks">MockBundleContextBase</a></td>
<td class="colLast">
<div class="block">Default implementations for all methods of <code>BundleContext</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../no/steria/osgi/mocks/MockServiceReference.html" title="class in no.steria.osgi.mocks">MockServiceReference</a>&lt;S&gt;</td>
<td class="colLast">
<div class="block">A lightweight object holding a reference to a service.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../no/steria/osgi/mocks/MockServiceReferenceBase.html" title="class in no.steria.osgi.mocks">MockServiceReferenceBase</a>&lt;S&gt;</td>
<td class="colLast">
<div class="block">Default implementations for all methods of <code>BundleContext</code>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../no/steria/osgi/mocks/MockServiceRegistration.html" title="class in no.steria.osgi.mocks">MockServiceRegistration</a>&lt;S&gt;</td>
<td class="colLast">
<div class="block">A mock for the object returned when registering a service with a
 BundleContext.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
<a name="package.description">
<!--   -->
</a>
<h2 title="Package no.steria.osgi.mocks Description">Package no.steria.osgi.mocks Description</h2>
<div class="block">This package contains mock implementations of the <a href="http://www.osgi.org/">OSGi framework</a>
 similar to what's found in <a href="https://sling.apache.org/documentation/development/osgi-mock.html">Apache Sling OSGi mocks</a>
 and in <a href="http://docs.spring.io/osgi/docs/current/reference/html/testing.html">Spring OSGi mocks</a>.

 <p>The implemented classes implement basic service registration, and retrieval,
 service notification and callback registration.

 <p>These OSGi mocks were written for unit tests in the <a href="http://sbang.github.io/jsr330activator/">Jsr330Activator project</a>
 because the <a href="https://sling.apache.org/documentation/development/osgi-mock.html">Apache Sling OSGi mocks</a>
 were compiled against an older version of OSGi than the <a href="http://sbang.github.io/jsr330activator/">Jsr330Activator</a>
 project was using, and because the <a href="http://docs.spring.io/osgi/docs/current/reference/html/testing.html">Spring OSGi mocks</a>
 didn't return null references for non-existing services, and because the tests required
 more logic than mockito mocks could provide.

 <p>These mocks can be used the <a href="http://sbang.github.io/jsr330activator/">Jsr330Activator</a>, they
 only have dependencies to the OSGi core and the java runtime, and they can be easily
 used in unit tests.

 <p>Add the following maven dependency:
 <pre>
   &lt;project&gt;
    &lt;dependencies&gt;
     &lt;dependency&gt;
      &lt;groupId&gt;no.steria.osgi.jsr330activator&lt;/groupId&gt;
      &lt;artifactId&gt;jsr330activator.mocks&lt;/artifactId&gt;
      &lt;version&gt;1.0.1&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
     &lt;/dependency&gt;
    &lt;/dependencies&gt;
   &lt;/project&gt;
 </pre>

 <p>Then in the test, create a <code>MockBundleContext</code> and give it as an argument where a BundleContext is expected, e.g. with a BundleActivator:
 <code>
 public class MyOsgiTests() {</div>
<dl>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>Steinar Bang</dd>
</dl>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../no/steria/osgi/mocks/package-summary.html">Package</a></li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Package</li>
<li>Next&nbsp;Package</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?no/steria/osgi/mocks/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<a name="skip.navbar.bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2018. All rights reserved.</small></p>
</body>
</html>
